import { request } from '@/utils/request';
import { RequestEnum } from '@/enums/httpEnum';

export const columnApi = {
  columnList: '/module/list',
  update: '/module/update',
  moduleDetail: '/module/detail',
  moduleContentUpdate: '/moduleContent/update',
  moduleAdd: '/module/add',
  moduleDelete: '/module/delete',
} as const;

export const addModule = (data: API.moduleContentAddDTO) => {
  return request({
    url: columnApi.moduleAdd,
    method: RequestEnum.POST,
    data,
  });
};

export const deleteModule = (params: { id: number }) => {
  return request({
    url: columnApi.moduleDelete,
    method: RequestEnum.DELETE,
    params,
  });
};
export const update = (params: { id: number }) => {
  return request({
    url: columnApi.update,
    method: RequestEnum.POST,
    params,
  });
};
export const moduleContentUpdate = (data: API.moduleContentUpdateDTO) => {
  return request({
    url: columnApi.moduleContentUpdate,
    method: RequestEnum.PUT,
    data,
  });
};
